<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'goods';
$return=array();
/*******basic*******/
if($_RQ['op']=='goods'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('basic');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'商品相关',
		'edit_tab'=>true,
		'edits'=>array(),
	);
	$list=array(
			array('type'=>'stringdiy','title'=>'指定商品不存在！','name'=>'goods_1','tip'=>'商品文字'),
			array('type'=>'stringdiy','title'=>'请先选择商品再下单','name'=>'goods_2'),
			array('type'=>'stringdiy','title'=>'您当前会员等级没有购买权限！','name'=>'goods_3'),
			array('type'=>'stringdiy','title'=>'您所在的用户组没有购买权限','name'=>'goods_4'),
			array('type'=>'stringdiy','title'=>'未到开始抢购时间','name'=>'goods_5'),
			array('type'=>'stringdiy','title'=>'抢购时间已经结束','name'=>'goods_6'),
			array('type'=>'stringdiy','title'=>'不满足购买条件','name'=>'goods_7'),
			array('type'=>'stringdiy','title'=>'商品已售罄','name'=>'goods_8'),
			array('type'=>'stringdiy','title'=>'单次最少购买','name'=>'goods_9'),
			array('type'=>'stringdiy','title'=>'单次最多购买','name'=>'goods_10'),
			array('type'=>'stringdiy','title'=>'只能购买活动品','name'=>'goods_11'),
			array('type'=>'stringdiy','title'=>'该商品已经关联其他插件','name'=>'goods_12'),
			array('type'=>'stringdiy','title'=>'该商品超出库存不能添加了','name'=>'goods_13'),
			array('type'=>'stringdiy','title'=>'您没有权限浏览该商品','name'=>'goods_14'),
	);
	$is_langs=str_array($this->setting['is_langs']);
	foreach($is_langs as $en){
		$one=array();
		$one['title']=$this->langs[$en];
		$one['list']=array();
		$one['list'][]=array('type'=>'jsup','title'=>'一键翻译本页内容','action'=>'jy_lang_weishop/index/upfanyi/en='.$en,'message'=>'确定要一键翻译吗？这样将覆盖原有设置','btntitle'=>'一键翻译');
		foreach($list as $fv){
			$fv['name']=$en.'_'.$fv['name'];
			$one['list'][]=$fv;
		}
		$htmls['edits'][]=$one;
	}
	if(!count($is_langs)){
		exi('基础设置--多语言开启--开启店铺语言（至少一个）,这里才显示内容','error');
	}
	$return['item']['fanyidata']=array();
	foreach($list as $k=>$fv){
		$return['item']['fanyidata']['_'.$fv['name']]=$fv['title'];
	}
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='store'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('basic');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'门店相关',
		'edit'=>array(
			array('type'=>'stringdiy','title'=>'店长账号不可以重复！','name'=>'store_1','tip'=>'门店文字'),
			array('type'=>'stringdiy','title'=>'结算单不存在或者不符合打款条件，打款失败！','name'=>'store_2'),
			array('type'=>'stringdiy','title'=>'该门店没有《有效店员》，打款失败！！','name'=>'store_3'),
			array('type'=>'stringdiy','title'=>'该门店没有《设置店长》！','name'=>'store_4'),
			array('type'=>'stringdiy','title'=>'该店员没有《绑定会员》！','name'=>'store_5'),
			array('type'=>'stringdiy','title'=>'暂不支持打款到支付宝','name'=>'store_6'),
			
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='order'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('basic');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'订单相关',
		'edit'=>array(
			array('type'=>'stringdiy','title'=>'请选择到店时间','name'=>'order_1','tip'=>'下单页面'),
			array('type'=>'stringdiy','title'=>'到店时间段已过！请选择其他时间！','name'=>'order_2'),
			array('type'=>'stringdiy','title'=>'请选择预约配送的时间！','name'=>'order_3'),
			array('type'=>'stringdiy','title'=>'超出配送时间！请选择预约配送','name'=>'order_4'),
			array('type'=>'stringdiy','title'=>'请先选择收货地址','name'=>'order_5'),
			array('type'=>'stringdiy','title'=>'请先完善收货地址','name'=>'order_6'),
			array('type'=>'stringdiy','title'=>'超出配送距离,无法购买','name'=>'order_7'),
			array('type'=>'stringdiy','title'=>'请先选择门店','name'=>'order_8'),
			array('type'=>'stringdiy','title'=>'请输入联系人和电话','name'=>'order_9'),
			array('type'=>'stringdiy','title'=>'订单金额不能小于零','name'=>'order_10'),
			array('type'=>'stringdiy','title'=>'请先选择地址','name'=>'order_11'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='news'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('basic');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'文章相关',
		'edit'=>array(
			array('type'=>'stringdiy','title'=>'未找到文章','name'=>'news_1','tip'=>'文章页面'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='member'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('basic');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'会员相关',
		'edit'=>array(
			array('type'=>'stringdiy','title'=>'请先选择要设置的地址','name'=>'member_1','tip'=>'会员中心页面'),
			array('type'=>'stringdiy','title'=>'请先选择要删除的地址','name'=>'member_2'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
